wait_timeout = "3"
bt_cmd = [
    # slave
    {
        "cmd": 'AT+BTCOMM=ENABLE?',
        "match": 'AT\+BTCOMM=ENABLE\?\s{4}\+BTCOMM:ENABLE=0,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE,1,0',
        "match": 'AT\+BTCOMM=ENABLE,1,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE?',
        "match": 'AT\+BTCOMM=ENABLE\?\s{4}\+BTCOMM:ENABLE=1,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLECOMM=NAME,Luat_Air724UG',
        "match": 'AT\+BLECOMM=NAME,Luat_Air724UG\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLECOMM=NAME?',
        "match": 'AT\+BLECOMM=NAME\?\s{4}\+BLECOMM:NAME="Luat_Air724UG"\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLEADV=ADVDATA,8,02010604ff313233',
        "match": 'AT\+BLEADV=ADVDATA,8,02010604ff313233\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLEADV=ADVDATA?',
        "match": 'AT\+BLEADV=ADVDATA\?\s{4}\+BLEADV:DATA=8,"02010604ff313233"\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLEADV=SCANRSPDATA,3,020A04',
        "match": 'AT\+BLEADV=SCANRSPDATA,3,020A04\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLEADV=SCANRSPDATA?',
        "match": 'AT\+BLEADV=SCANRSPDATA\?\s{4}\+BLEADV:DATA=3,"020A04"\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLEADV=ENABLE,1',
        "match": 'AT\+BLEADV=ENABLE,1\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLEADV=ENABLE?',
        "match": 'AT\+BLEADV=ENABLE\?\s{4}\+BLEADV:ENABLE=1\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLEADV=ENABLE,0',
        "match": 'AT\+BLEADV=ENABLE,0\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLEADV=ENABLE?',
        "match": 'AT\+BLEADV=ENABLE\?\s{4}\+BLEADV:ENABLE=0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE,0,0',
        "match": 'AT\+BTCOMM=ENABLE,0,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE?',
        "match": 'AT\+BTCOMM=ENABLE\?\s{4}\+BTCOMM:ENABLE=0,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    # master
    {
        "cmd": 'AT+BTCOMM=ENABLE,1,1',
        "match": 'AT\+BTCOMM=ENABLE,1,1\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE?',
        "match": 'AT\+BTCOMM=ENABLE\?\s{4}\+BTCOMM:ENABLE=1,1\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLESCAN=ENABLE?',
        "match": 'AT\+BLESCAN=ENABLE\?\s{4}\+BLESCAN:ENABLE=0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE,0,1',
        "match": 'AT\+BTCOMM=ENABLE,0,1\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE?',
        "match": 'AT\+BTCOMM=ENABLE\?\s{4}\+BTCOMM:ENABLE=0,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    # beacon
    {
        "cmd": 'AT+BTCOMM=ENABLE,1,0',
        "match": 'AT\+BTCOMM=ENABLE,1,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLEADV=BEACONDATA,"F2C3F0AEA9FA158C9D49AE73710A81E7",10107,50179',
        "match": 'AT\+BLEADV=BEACONDATA,"F2C3F0AEA9FA158C9D49AE73710A81E7",10107,50179\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLEADV=BEACONDATA?',
        "match": 'AT\+BLEADV=BEACONDATA\?\s{4}\+BLEADV:BEACONDATA="F2C3F0AEA9FA158C9D49AE73710A81E7",10107,50179\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+BLEADV=ENABLE,1',
        "match": 'AT\+BLEADV=ENABLE,1\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BLEADV=ENABLE,0',
        "match": 'AT\+BLEADV=ENABLE,0\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+BTCOMM=ENABLE,0,0',
        "match": 'AT\+BTCOMM=ENABLE,0,0\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
]
